package hxy.bytecode.algorithm.fibonacci;

/**
 * @author eric
 * @program bytecode
 * @description 迭代算法实现
 * @date 2021/1/4
 */
public class Fibonacci2 {
    public static void main(String[] args) {

        int a = 0;
        int b = 1;
        int c;
        int sum = a + b;
        for (int i = 0; i < 20; i++) {
            c = a + b;
            System.out.println(c);
            sum += c;
            a = b;
            b = c;
        }
        System.out.println("和=" + sum);
    }
}
